<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
	<head>
		<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
		<title>卡拉卡-在线选号平台</title>
		<link href="/css/style.css" rel="stylesheet" type="text/css" />
		<link href="/css/win.css" rel="stylesheet" type="text/css" />
		<link href="/css/pagination.css" rel="stylesheet" type="text/css" />
		<script type="text/javascript" src="../js/jquery-1.7.min.js"></script>
		<script type="text/javascript" src="../js/jquery.cookie.js"></script>
		<script type="text/javascript" src="../js/jquery.pagination.js"></script>
		<script type="text/javascript" src="../js/logon.js"></script>
		<script type="text/javascript" src="../js/jquery.blockUI.js"></script>
		<script type="text/javascript" src="../js/ajaxfileupload.js"></script>
		<script src="js/win.js" language="javascript" type="text/javascript"></script>
		<script language="javascript" type="text/javascript">
			var page = 0; //页面索引初始值
			var pageSize = 9; //每页显示条数初始化，修改显示条数，修改这里即可
			$(function () {
				//initTable(10); //Load事件，初始化表格数据，页面索引为0（第一页）
				//分页，PageCount是总条目数，这是必选参数，其它参数都是可选
				$("#Pagination").pagination($!{model.get("count")}, {
					callback:PageCallback, //PageCallback() 为翻页调用次函数。
					prev_text:"上一页",
					next_text:"下一页",
					items_per_page:pageSize,
					num_edge_entries:2, //两侧首尾分页条目数
					num_display_entries:3, //连续分页主体部分分页条目数
					current_page:page, //当前页索引
				});
				//翻页调用
				function PageCallback(page,jq) {
					initTable(page);
				}
				//请求数据
				function initTable(page) {
					$.ajax({
						type:"POST",
						dataType:"text",
						url:"/admin/package/page", //提交到一般处理程序请求数据
						data:{page:page+1,pageSize:pageSize,keyword:'$!{model.get("keyword")}'}, //提交两个参数：pageIndex(页面索引)，pageSize(显示条数)
						success:function(data){
						//alert(data);
							$('#list-content').html('');
							$('#list-content').html(data);
							//$("#Result tr:gt(0)").remove();//移除Id为Result的表格里的行，从第二行开始（这里根据页面布局不同页变）
							//$("#Result").append(data); //将返回的数据追加到表格
						}
					});
				}
			});
			
			function search()
			{
				$("#searchForm").submit();
			}
			
			function showD()
			{
				$.blockUI({ message: $('#pop')});
			}
			function importFile()
			{
				var filename =$.trim($("#textfield").val());
			    if(filename!=''){
				 	$.ajaxFileUpload({ //一个Ajax过程 
						type: "post", //以post方式与后台沟通 
						url : "/admin/package/import",
						secureuri: false, 
			          	fileElementId: 'fileField',
				     	dataType:'json',
				     	success: function(data)
				     	{
							alert(data);
							$("#searchForm").submit();
							$("#textfield").val("");
							$.unblockUI();
						}
					});
				}else{
					alert("请选择文件!");
				}
			}
			function hideD()
			{
				$.unblockUI();
			}
		</script>
	</head>

	<body>
		<!--首先设置一个层:-->
		<div id="pop" class="sow" style="display:none"> 
			<div class="sowbody">
				<div class="pop_title"><span>导入文件</span></div>
				<div class="file-box">
				<form action="" method="post" enctype="multipart/form-data">
				<table width="100%" border="0" cellspacing="0" cellpadding="8" class="pop_table">
	  				<tr>
						<td height="120" colspan="2" align="center" valign="middle">
						<input type='text' name='textfield' id='textfield' class='txt' /> 
						<input type='button' class='btn' value='浏览...' onclick="fileField.click();"/> 
						<input type="file" name="fileField" class="file" id="fileField" size="28" onchange="document.getElementById('textfield').value=this.value" />
		  				</td>
	  				</tr>
	  				<tr>
					<td align="center" class="td_n">
						<input type="button" name="Submit" value="确定" class="out_btn"  onclick="importFile();"/> 
						<input type="button" name="Submit" value="取消" class="out_btn"  onclick="hideD()"/></td>
	  				</tr>
  				</table>
  				</form>
  				</div>
			</div> 
		</div>
		#include("header.html")
		<table width="100%" border="0" cellspacing="0" cellpadding="0" id="content">
			<tr><td valign="top" id="menu">
			#include("menu_admin.html")
			</td>
			<td id="right">
				<div id="order">
					<form id="searchForm" name="searchForm" action="/admin/package" method="post">
					<div class="title">
						<span>首页 &gt; 套餐管理</span>
					</div>
					<div class="step">
						关键字：
						<input type="text" name="keyword" class="sou_input" value="$!{model.get("keyword")}"/>
						<input type="button" name="Submit" value="查询" class="out_btn" onclick="search();" />
					</div>
					</form>
				</div>
				<div id="list">
					<div class="title" style="font-size:13px;font-weight:600;display:none">
						<span>查询结果</span>
					</div>
					<div class="data">
						<table width="100%" border="0" cellspacing="0" cellpadding="0">
							<thead>
							<tr>
								<td>套餐名称</td>
								<td width="120">运营商</td>
								<td width="80">套餐月费</td>
								<td width="160">国内语音拨打分钟数</td>
								<td width="100">包国内流量</td>
								<td width="80">短信条数</td>
								<!-- <td width="60">操作</td> -->
							</tr>
							</thead>
							<tbody id="list-content">
							</tbody>
							<tr>
								<td colspan="6">
									<table width="100%" border="0" cellspacing="0" cellpadding="0">
										<tr>
											<td><a href="javascript:void(0);" id="btn_import" onclick="showD();">导入</a></td>
											<td><div id="Pagination" class="pagination" style="margin:4px 0 0 0"></div></td>
											<td width="80">共$!{model.get("count")}条</td>
										</tr>
									</table>
								</td>
							</tr>
						</table>
					</div>
				</div>
				</td></tr></table>
		#include("footer.html")
	</body>
</html>
